<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

namespace App\Console\Commands;

use App\Models\Developing;
use Illuminate\Console\Command;

class InitDeveData extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'init:development';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '初始化发展历程';

    /**
     * Create a new command instance.
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        Developing::query()->firstOrCreate([
            'time_type' => 1,
            'place_type' => 1,
            'content' => '回顾历史-朝阳区',
        ], [
            'content' => '回顾历史-朝阳区',
        ]);

        Developing::query()->firstOrCreate([
            'time_type' => 1,
            'place_type' => 2,
            'content' => '回顾历史-金盏乡',
        ], [
            'content' => '回顾历史-金盏乡',
        ]);

        Developing::query()->firstOrCreate([
            'time_type' => 1,
            'place_type' => 3,
            'content' => '回顾历史-东窑村',
        ], [
            'content' => '回顾历史-东窑村',
        ]);

        Developing::query()->firstOrCreate([
            'time_type' => 2,
            'place_type' => 1,
        ], [
            'content' => '立足现在-朝阳区',
        ]);

        Developing::query()->firstOrCreate([
            'time_type' => 2,
            'place_type' => 2,
            'content' => '立足现在-金盏乡',
        ], [
            'content' => '立足现在-金盏乡',
        ]);

        Developing::query()->firstOrCreate([
            'time_type' => 2,
            'place_type' => 3,
            'content' => '立足现在-东窑村',
        ], [
            'content' => '立足现在-东窑村',
        ]);

        Developing::query()->firstOrCreate([
            'time_type' => 3,
            'place_type' => 1,
            'content' => '展望未来-朝阳区',
        ], [
            'content' => '展望未来-朝阳区',
        ]);

        Developing::query()->firstOrCreate([
            'time_type' => 3,
            'place_type' => 2,
            'content' => '展望未来-金盏乡',
        ], [
            'content' => '展望未来-金盏乡',
        ]);

        Developing::query()->firstOrCreate([
            'time_type' => 3,
            'place_type' => 3,
            'content' => '展望未来-东窑村',
        ], [
            'content' => '展望未来-东窑村',
        ]);
        $this->info('发展历程初始化完成');
        return 0;
    }
}
